/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package util;

import java.awt.*;
import javax.swing.text.*;

/**
 *
 * @author Márcio
 */
public class NumericPlainDocument extends PlainDocument {

    public void insertString(int offset, String str, AttributeSet a) throws BadLocationException {
        for (int i = 0; i < str.length(); i++) {
            if (!Character.isDigit(str.charAt(i))) {
                Toolkit.getDefaultToolkit().beep();
                return;
            }
        }
        super.insertString(offset, str, a);
    }
}
